package com.bb.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class loginInterceptor extends AbstractInterceptor{
	//验证登录权限的拦截器
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		Map<String, Object> session = ActionContext.getContext().getSession();
		String username = (String) session.get("username");
		System.out.println(username);
		if(username != null){
			String invoke = invocation.invoke();
			System.out.println("验证是否登录，进行相应的拦截");
			return invoke;
		}
		return "userLoginFalse";
	}

}
